package com.ecp.commons.filter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ecp.util.WebUtil;

public class WebContext {
	private HttpServletRequest	request;
	private HttpServletResponse	response;
	private int					columnId;
	private int					actionId;
	private String				remoteAddr;

	public WebContext() {
	}

	public WebContext(HttpServletRequest request, HttpServletResponse response) {
		this.request = request;
		this.response = response;
	}

	public String getRealPath() {
		String contextRealPath = request.getSession().getServletContext().getRealPath("");
		return contextRealPath;
	}

	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}

	public void setResponse(HttpServletResponse response) {
		this.response = response;
	}

	public void setColumnId(int columnId) {

		this.columnId = columnId;
	}

	public void setActionId(int actionId) {
		this.actionId = actionId;
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	public HttpServletResponse getResponse() {
		return response;
	}

	public int getColumnId() {
		return columnId;
	}

	public int getActionId() {
		return actionId;
	}
	
	public String getRemoteAddr() {
		return remoteAddr;
	}

	public void setRemoteAddr(String remoteAddr) {
		this.remoteAddr = remoteAddr;
	}

	public int getMerchantId() {
		HttpServletRequest request = this.getRequest();
		return WebUtil.getMerchantID(request);
	}
}
